{if $grid->ordering}
{literal}
<script type="text/javascript">
$(document).ready(function(){
	$("#{/literal}{$grid->id}{literal} > div.fg_imageGridImage").fg_galleryItem({
		'id': "{/literal}{$grid->id}{literal}",
		'name' : "{/literal}{$grid->name}{literal}"
	});
});
</script>
{/literal}
{/if}
<div class="fg_imageGrid" id="{$grid->id}">
	{foreach key=a item=i from=$images}
		<div class="fg_imageGridImage" id="image_{$a}">
			<div class="fg_imageGridImageInner">
				{foreach item=f key=k from=$fields}
					<div style="margin-bottom:3px;{$i.$k.style}{if $i.link};cursor:pointer{/if}" {if $i.$k.link}onclick="document.location='{$i.$k.link}'"{/if} >
						{$i.$k.value}
					</div>
				{/foreach}
			</div>
		</div>
	{/foreach}
	<div id="{$grid->id}_separator" class="fg_imageGridSeparator" style="display:none;"></div>
</div>
<input type="hidden" id="{$grid->id}_order" name="{$grid->name}[order]" value="{$input->value}">
